#!/usr/bin/perl

# $ARGV[0] is the directory.
# $ARGV[1] is the output directory.

opendir (SPLICE_RESULTS, "$ARGV[0]") || die "Can't open splice counts directory:$ARGV[0]";
while ($splice_counts = readdir(SPLICE_RESULTS)){
    $splicing_bed = $splice_counts;
    $splicing_bed =~ s/splicing_results/splicing_track/;

    print "$splicing_file\n";

    $command = "awk -f splice_id_to_junction_bed.awk $ARGV[0]/$splice_counts > $ARGV[1]/$splicing_bed";
    print "command = $command\n";

    system($command);
}

closedir (SPLICE_RESULTS);
